/*
 * Socket.h
 *
 *  Created on: 16/06/2014
 *      Author: nicolas
 */

#ifndef SOCKET_H_
#define SOCKET_H_

#include	<sys/types.h>

class Socket {
private:
	int sockfd;

public:

	Socket();
	Socket(int sockfd);
	int getFd();

	int bindTo(int port);
	int listenTo(int size);
	int connectTo(const char *server, int puerto);
	int connectTo(struct sockaddr *server, int puerto);
	int acceptFrom();

	int send(void *datos, size_t nbytes);
	int recv(void *datos, size_t nbytes);

	void closeSock();

};

#endif /* SOCKET_H_ */
